const d=require('../controllers/dish.server.controller');
function fn(app){

    app.use('/dish',function (req,res,next) {
        if (!req.session.mid){
            res.redirect('merchantLogin1.html');
        }else{
            next();
        }
    });

    app.route("/dishes")
        .get(d.loadDishes);

    app.route("/dish/:_id")
        .put(d.updateDishRecommend)
        .delete(d.deleteDish);

    app.route("/dish")
        .post(d.addDish);

    app.route("/upload")
        .post(d.uploadImg);


}

module.exports=fn;